package com.zjw.zy.base;

import android.content.Context;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/9/29 17:46
 */
public abstract class BaseDialog extends AlertDialog {

    protected BaseDialog(@NonNull Context context) {
        super(context);
    }

    protected BaseDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected BaseDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(onLayoutId());
        onFindView();
        onBindListener();
    }

    @Override
    public void onAttachedToWindow() {
        onBindValue();
        super.onAttachedToWindow();
    }

    @Override
    public void show() {
        super.show();
    }

    protected abstract void onFindView();

    protected abstract void onBindListener();

    protected abstract void onBindValue();

    protected abstract int onLayoutId();
}
